package com.example.mvpdemo.mvp4;

import com.example.mvpdemo.net.IRetrofit;
import com.example.mvpdemo.net.NetworkCallback;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;

public class LoginModel4 {


    public LoginModel4() {

    }

    public void login(String username, String pwd, final NetworkCallback networkCallback) {
        new Retrofit.Builder().baseUrl("http://10.0.2.2:8888/").build().create(IRetrofit.class).getUser(username, pwd).enqueue(new Callback<ResponseBody>() {
            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                if (networkCallback != null)
                    networkCallback.result(response.toString());
            }

            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {

            }
        });
    }

}
